package com.fanxuankai.boot.monitor.jdbc;

import com.fanxuankai.boot.monitor.Monitor;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * @author fanxuankai
 */
@ConditionalOnProperty(ChecksumProperties.PREFIX + "." + ChecksumProperties.ENABLED)
@ConditionalOnClass({HikariDataSource.class, JdbcTemplate.class})
@EnableConfigurationProperties({ChecksumProperties.class})
public class ChecksumAutoConfiguration {
    @Bean
    public Monitor checksumMonitor() {
        return new ChecksumMonitor();
    }
}
